﻿<phone:PhoneApplicationPage 
    x:Class="Wulong.Phone.Dianping.Views.GroupOnListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False"
    Style="{StaticResource TransitionPageStyle}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/PageBackground.png"/>
        </Grid.Background>
        <adduplex:AdControl xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.AdControl.Silverlight"
                            Grid.Row="0" 
                            AppId="4135" 
                            Background="Transparent"
                            BackgroundOpacity="0.5"
                            />
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="1">            
            <TextBlock x:Name="PageTitle" 
                       Text="{Binding Path=Appi18n.GroupOn, Source={StaticResource ls}}" 
                       Margin="9,-7,0,0" 
                       Style="{StaticResource PhoneTextTitle1Style}"/>
            <StackPanel Orientation="Horizontal">
                <Button x:Name="Load" BorderThickness="0" BorderBrush="Transparent">
                    <StackPanel>
                        <Image Source="/Images/BtnRefresh.png"
                Margin="5,5,5,0"/>
                        <TextBlock
                            HorizontalAlignment="Center"
                            FontSize="16"
                            Text="{Binding Path=Appi18n.Btn_Refresh, Source={StaticResource ls}}"/>
                    </StackPanel>
                </Button>
            </StackPanel>
            
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" 
              Grid.Row="2" 
              Margin="12,0,12,0">
            <ListBox x:Name="GroupOns">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Button cal:Message.Attach="[Event Click]=[Action ViewItem($dataContext)]"
                                Style="{StaticResource ListItemBtnStyle}">
                            <Border BorderThickness="2" BorderBrush="Fuchsia">
                            <StackPanel>
                                <Image 
                                    Source="{Binding ImageUrl}"
                                    Margin="5"
                                    HorizontalAlignment="Center"/>
                                <TextBlock Text="{Binding Desc}" 
                                    TextWrapping="Wrap" 
                                    Width="300"/>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Price}"
                                               Style="{StaticResource ListSubtitleStyle}"/>
                                    <TextBlock Text="{Binding ItemsSoldDesc}"
                                               Style="{StaticResource ListSubtitleStyle}"/>
                                </StackPanel>    
                            </StackPanel>
                            </Border>
                        </Button>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
    <shell:SystemTray.ProgressIndicator>
        <shell:ProgressIndicator 
            IsIndeterminate="{Binding IsBusy}" 
            IsVisible="{Binding IsBusy}"
            Text="{Binding Path=Appi18n.Loading, Source={StaticResource ls}}"/>
    </shell:SystemTray.ProgressIndicator>
</phone:PhoneApplicationPage>
